/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('wfts', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetLjxAccountInfoRequest {
  ljxAccountInfoId?: string(name='LjxAccountInfoId', description='实例 ID。'),
}

model GetLjxAccountInfoResponseBody = {
  apple?: string(name='Apple'),
  ljxAccountInfoId?: string(name='LjxAccountInfoId', description='资源一级ID'),
  requestId?: string(name='requestId', description='Id of the request'),
}

model GetLjxAccountInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetLjxAccountInfoResponseBody(name='body'),
}

async function getLjxAccountInfo(request: GetLjxAccountInfoRequest): GetLjxAccountInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getLjxAccountInfoWithOptions(request, headers, runtime);
}

async function getLjxAccountInfoWithOptions(request: GetLjxAccountInfoRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetLjxAccountInfoResponse {
  Util.validateModel(request);
  var query : map[string]any= {};
  if (!Util.isUnset(request.ljxAccountInfoId)) {
    query['LjxAccountInfoId'] = request.ljxAccountInfoId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetLjxAccountInfo',
    version = '2022-02-12',
    protocol = 'HTTPS',
    pathname = `/get/ljx/acc`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

